//
//  HJCBaseTableViewController.swift
//  新浪微博Swift
//
//  Created by 郝俊聪 on 15/5/10.
//  Copyright (c) 2015年 heima. All rights reserved.
//

import UIKit





class HJCBaseTableViewController: UITableViewController,HJCVisirorViewDelegate {
    

    var userLogin = sharedaccount == nil ? false : true
    
    var visitorView : HJCVisitorView?
    
    override func loadView()
    {
        
        if userLogin  == true
        {
            
            super.loadView()
  
            return
        }
        
        visitorView = (NSBundle.mainBundle().loadNibNamed("visitorView", owner: nil, options: nil).last) as? HJCVisitorView
        
        visitorView?.delegate = self
        
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "clickLoginBtn")
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "clickRegisterBtn")
        
        
        view = visitorView
    }
    
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        
       
       
    }
    
    //MARK: - HJCVisirorViewDelegate
    func clickLoginBtn() {
        //跳到登录
        let sb : UIStoryboard = UIStoryboard(name: "OAuth", bundle: nil)
        
        let vc = sb.instantiateInitialViewController() as! UIViewController
        
        presentViewController(vc, animated: true) { () -> Void in
            
        }
        
    }
  
    func clickRegisterBtn() {
        println("\(__FUNCTION__)")
    }
    

    
}
